package com.xiaoxi.exam.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateUtils {

  private static final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
  private static final DateTimeFormatter examDate = DateTimeFormatter.ofPattern("yyyy年M月d日");

  public static LocalDateTime formatter(String datetime) {
    return LocalDateTime.parse(datetime, dtf);
  }

  public static LocalDate getExamDate(String datetime) {
    return LocalDate.parse(datetime, examDate);
  }

  public static String parse(LocalDateTime dateTime) {
    return dateTime.format(dtf);
  }

}
